package com.etpjava.service.impl;

import java.util.Date;
import java.util.List;

import com.etpjava.dao.RewardDao;
import com.etpjava.dao.impl.RewardDaoImpl;
import com.etpjava.model.Reward;
import com.etpjava.service.RewardService;

public class RewardServiceImpl implements RewardService{
	
	RewardDao rewarddao = new RewardDaoImpl();
	
	@Override
	public void add(Reward cj) {
		rewarddao.save(cj);
		
	}

	@Override
	public void delete(int id) {
		Reward reward = rewarddao.findById(id);
		rewarddao.delete(reward);
		
	}

	@Override
	public void deleteMore(int[] ids) {
		for (int id : ids) {
			Reward reward = rewarddao.findById(id);
			rewarddao.delete(reward);
		}
		
	}
	
	@Override
	public void modify(Reward cj) {

		rewarddao.update(cj);
	}
	
	@Override
	public Reward findById(int id) {
		return rewarddao.findById(id);
	}	
	
	@Override
	public List<Reward> findAll() {
		return rewarddao.findAll();
	}
	
	@Override
	public List<Reward> findAll(int st) {
		return rewarddao.findAll(st);
	}
	
	@Override
	public List<Reward> findByTitle(String title) {

		return rewarddao.findByTitle(title);
	}
	
	@Override
	public List<Reward> findByTitle(String title, int st) {
		
		return rewarddao.findByTitle(title, st);
	}
	
	@Override
	public List<Reward> findByType(String type) {

		return rewarddao.findByType(type);
	}
	
	@Override
	public List<Reward> findByType(String type, int st) {
		
		return rewarddao.findByType(type, st);
	}
	
	@Override
	public List<Reward> findByTime(Date time) {
		
		return rewarddao.findByTime(time);
	}
	
	@Override
	public List<Reward> findByTime(Date time, int st) {

		return rewarddao.findByTime(time, st);
	}
	
	@Override
	public List<Reward> findByContent(String content) {

		return rewarddao.findByContent(content);
	}
	
	@Override
	public List<Reward> findByContent(String content, int st) {
		
		return rewarddao.findByContent(content, st);
	}

	@Override
	public List<Reward> findByPenalty(float penalty) {
		
		return rewarddao.findByPenalty(penalty);
	}

	@Override
	public List<Reward> findByPenalty(float penalty, int st) {
		
		return rewarddao.findByPenalty(penalty, st);
	}

}
